<template>
  <div>
    <div class="title">
      <el-row>
        <el-col :span="1" style="width: 50px;">
          <span style="color:#757575;">位置 :</span>
        </el-col>
        <el-col :span="20">
          <span class="hand">面试结果</span>
        </el-col>
      </el-row>
    </div>
    <div class="posttable">
      <el-row type="flex" justify="center" style="height: 50px;
    line-height: 50px;">
        <el-col :span="23">
          <div style="float: left;width: 50%;">
            <el-row>
              <el-col style="width: 40px;margin-right: 5px;">
                <h5>搜索 :</h5>
              </el-col>
              <el-col :span="20" class="interviewtrack">
                <el-select v-model="cname" @change="selectname">
                  <el-option
                    v-for="(item,index) in list"
                    :key="index"
                    :label="item.name"
                    :value="item.name"
                  ></el-option>
                </el-select>
              </el-col>
            </el-row>
          </div>
          <div class="interviewtrack1 right1" style="float: right;">
            <el-input
              v-model.trim="searchword"
              size="small"
              placeholder="请输入内容"
              @keyup.enter.native="search"
            >
              <i
                slot="suffix"
                class="el-input__icon el-icon-search"
                style="cursor: pointer;"
                @click="search"
              ></i>
            </el-input>
            <el-button class="send" size="small" round @click="sendClick">申请</el-button>
            <el-button class="entry" size="small" round @click="transfer">转入职</el-button>
            <el-button class="edit" size="small" @click="giveup" round>放弃入职</el-button>
            <el-button class="delete" @click="deletedata" size="small" round>取消放弃</el-button>
          </div>
        </el-col>
      </el-row>
      <el-row type="flex" justify="center">
        <el-col :span="23" class="posttable2">
          <el-table
            class="resumetable"
            ref="singleTable"
            :data="tableData"
            highlight-current-row
            @current-change="handleCurrentChange"
          >
            <el-table-column prop="name" label="姓名"></el-table-column>
            <el-table-column v-if="ifname" prop="customerName" label="推送客户"></el-table-column>
            <el-table-column prop="postName" label="推送职位"></el-table-column>
            <el-table-column prop="postLevel" label="职位级别"></el-table-column>

            <el-table-column prop="type" label="面试次数"></el-table-column>
            <el-table-column prop="candidateTime" label="面试时间"></el-table-column>
            <el-table-column prop="result" label="面试结果">
              <template slot-scope="scope">
                <span v-if="scope.row.result == '审批通过' || scope.row.result == '审批驳回'" @click="resultShow(scope)" style="color: #119aff;cursor: pointer;">{{scope.row.result}}</span>
                <span v-else>{{scope.row.result}}</span>
              </template>
            </el-table-column>
            <el-table-column label="专员操作">
              <template slot-scope="scope">
                <span v-if="scope.row.zyIsoperate == '暂无反馈'">{{scope.row.zyIsoperate}}</span>
                <span
                  style="cursor: pointer; color:#1198ff;"
                  v-if="scope.row.zyIsoperate == '放弃入职'"
                  @click="viewdetail1(scope.row)"
                >{{scope.row.zyIsoperate}}</span>
                <span
                  style="cursor: pointer; color:#1198ff;"
                  v-if="scope.row.zyIsoperate == '取消放弃'"
                  @click="viewdetail2(scope.row)"
                >{{scope.row.zyIsoperate}}</span>
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <span @click="detailShow(scope)" style="color: #119aff;cursor: pointer;">查看详情</span>
              </template>
            </el-table-column>
          </el-table>

          <div class="pager">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="pagehandleCurrentChange"
              :current-page="currentPage"
              :page-sizes="[5,10,15]"
              :page-size="pagesize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount"
            ></el-pagination>
          </div>
        </el-col>
      </el-row>
    </div>

    <el-dialog
      title="查看详情"
      :visible.sync="detaildialogVisible"
      width="570px"
      :before-close="detailClose"
      class="addroledialog resultdetail"
    >
      <div style="text-align: left;width: 524px;margin-top: 40px;">
        <el-row>
          <el-col style="margin-bottom: 5px;" v-for="(item,index) in situation" :key="index">
            <el-col style="width: 21%;margin-top: -2px;color: #343434;font-weight: 700;">
              <div style="float: right;margin-bottom: 10px;">{{item.type}}情况</div>
              <div style="float: right;">{{item.dateTime}}</div>
            </el-col>
            <el-col style="width: 6%;">
              <el-row type="flex" justify="center">
                <el-col style="width: 14px;">
                  <div
                    style="width: 12px;height: 12px;border-radius: 50%;border: 1px solid #1864c7;margin-bottom: 5px;"
                  >
                    <div
                      style="width: 6px;height: 6px;border-radius: 50%;background-color: #1864c7;margin: 0 auto;margin-top: 3px;"
                    ></div>
                  </div>
                  <div style="width: 1px;height: 80px;background-color: #1865c6;margin: 0 auto;"></div>
                </el-col>
              </el-row>
            </el-col>
            <el-col style="width: 73%;margin-top: -10px;">
              <div
                style="width: 379px;border-radius: 5px;background-color:#f4f4f4;margin-left: 10px;"
              >
                <div class="arrow"></div>
                <div style="width: 337px;min-height: 85px;margin: 0 auto;padding-top: 8px;">
                  <el-col>
                    <span style="color: #333;font-weight: 700;">面试结果 :</span>
                    <span style="color:#fb8284;">{{item.result}}</span>
                  </el-col>
                  <el-col style="margin-bottom: 10px;">
                    <span style="color: #333;font-weight: 700;">面试反馈 :</span>
                    <span style="color:#9b9b9b;">{{item.backInfo}}</span>
                  </el-col>
                </div>
              </div>
            </el-col>
          </el-col>
          <el-col style="margin-bottom: 20px;">
            <el-col style="width: 21%;margin-top: -2px;font-weight: 700;">
              <div style="float: right;color: #1e66c5;">结束</div>
            </el-col>
            <el-col style="width: 6%;">
              <el-row type="flex" justify="center">
                <el-col style="width: 14px;">
                  <div
                    style="width: 12px;height: 12px;border-radius: 50%;border: 1px solid #1864c7;margin-bottom: 5px;"
                  >
                    <div
                      style="width: 6px;height: 6px;border-radius: 50%;background-color: #1864c7;margin: 0 auto;margin-top: 3px;"
                    ></div>
                  </div>
                </el-col>
              </el-row>
            </el-col>
          </el-col>
        </el-row>
      </div>
    </el-dialog>

    <el-dialog
      title="错误"
      :visible.sync="errordialogVisible"
      width="30%"
      :before-close="handleClose"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">尚未选择任何候选人</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" round @click="handleClose">确 定</el-button>
        <el-button round @click="handleClose" class="cancel">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="错误"
      :visible.sync="errordialogVisible2"
      width="30%"
      :before-close="handleClose2"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">该状态不可放弃入职</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" round @click="handleClose2">确 定</el-button>
        <el-button round @click="handleClose2" class="cancel">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="错误"
      :visible.sync="errordialogVisible3"
      width="30%"
      :before-close="handleClose3"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">该状态不可取消放弃</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" round @click="handleClose3">确 定</el-button>
        <el-button round @click="handleClose3" class="cancel">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="错误"
      :visible.sync="errordialogVisible1"
      width="30%"
      :before-close="handleClose1"
      class="deletedialog"
    >
      <div style="text-align: center">
        <i class="el-icon-warning" style="font-size: 20px;color: #fcb543;">
          <span style="font-size: 16px;color: #333;margin-left: 12px;">{{errorinfo}}</span>
        </i>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="sure" round @click="handleClose1">确 定</el-button>
        <el-button round @click="handleClose1" class="cancel">取 消</el-button>
      </span>
    </el-dialog>

    <el-dialog
      title="入职"
      :visible.sync="transferdialogVisible"
      width="415px"
      :before-close="transferClose"
      class="addroledialog back1"
    >
      <div style="text-align: left">
        <el-form
          label-position="top"
          ref="transferform"
          :rules="transferrules"
          :model="transferform"
          style="padding:0px 50px;"
        >
          <el-form-item label="入职时间" prop="entryTime">
            <el-col>
              <el-date-picker
                width="100%"
                v-model="transferform.entryTime"
                type="date"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                placeholder="请输入入职时间"
              ></el-date-picker>
            </el-col>
          </el-form-item>
          <el-form-item label="入职时间范围" prop="realEntryScore">
            <el-col>
              <el-select
                v-model.trim="transferform.realEntryScore"
                placeholder="请选择时间范围"
                class="timeselect"
              >
                <el-option
                  v-for="(item,index) in timelist"
                  :key="index"
                  :label="item"
                  :value="item"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
          <el-form-item label="到岗时间" prop="sceneTime">
            <el-date-picker
              width="100%"
              v-model="transferform.sceneTime"
              type="date"
              value-format="yyyy-MM-dd"
              format="yyyy-MM-dd"
              placeholder="请输入到岗时间"
            ></el-date-picker>
          </el-form-item>

          <el-form-item label="到岗时间范围" prop="realSceneScore">
            <el-col>
              <el-select
                v-model.trim="transferform.realSceneScore"
                placeholder="请选择时间范围"
                class="timeselect"
              >
                <el-option
                  v-for="(item,index) in timelist"
                  :key="index"
                  :label="item"
                  :value="item"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
          <el-form-item label="身份证号" prop="idCard">
            <el-col>
              <el-input v-model.trim="transferform.idCard" placeholder="请输入身份证号"></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="毕业证号" prop="idDiploma">
            <el-col>
              <el-input v-model.trim="transferform.idDiploma" placeholder="请输入毕业证号"></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="学历证号" prop="idEducation">
            <el-col>
              <el-input v-model.trim="transferform.idEducation" placeholder="请输入学历证号"></el-input>
            </el-col>
          </el-form-item>
          <el-col>
            <el-form-item>
              <div style="max-width:32rem;margin-top: 10px;">
                <el-upload
                  class="upload-demo"
                  ref="upload"
                  type="file"
                  :action="actionurl"
                  :before-upload="beforeupload"
                  :show-file-list="true"
                  :file-list="fileList"
                  :on-success="handleAvatarSuccess"
                  :on-remove="handleRemove"
                  :limit="2"
                  accept=".pdf"
                >
                  <el-button class="upload" slot="trigger">选取身份证信息文件</el-button>
                </el-upload>
              </div>
            </el-form-item>
            <el-col style="margin-bottom: 10px;">
              <div
                v-if="!filetype"
                style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
              >文件上传格式为pdf。</div>
              <div
                v-if="selectfile"
                style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
              >请上传身份证信息文件!</div>
            </el-col>
          </el-col>

          <el-col>
            <el-form-item>
              <div style="max-width:32rem;">
                <el-upload
                  class="upload-demo"
                  ref="upload1"
                  type="file"
                  :action="actionurl1"
                  :before-upload="beforeupload1"
                  :show-file-list="true"
                  :file-list="fileList1"
                  :on-success="handleAvatarSuccess1"
                  :on-remove="handleRemove1"
                  :limit="2"
                  accept=".pdf"
                >
                  <el-button class="upload" slot="trigger">选取毕业证信息文件</el-button>
                </el-upload>
              </div>
            </el-form-item>
            <el-col style="margin-bottom: 10px;">
              <div
                v-if="!filetype1"
                style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
              >文件上传格式为pdf。</div>
              <div
                v-if="selectfile1"
                style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
              >请上传毕业证信息文件!</div>
            </el-col>
          </el-col>

          <el-col>
            <el-form-item>
              <div style="max-width:32rem;">
                <el-upload
                  class="upload-demo"
                  ref="upload2"
                  type="file"
                  :action="actionurl2"
                  :before-upload="beforeupload2"
                  :show-file-list="true"
                  :file-list="fileList2"
                  :on-success="handleAvatarSuccess2"
                  :on-remove="handleRemove2"
                  :limit="2"
                  accept=".pdf"
                >
                  <el-button class="upload" slot="trigger">选取学历证书息文件</el-button>
                </el-upload>
              </div>
            </el-form-item>
            <el-col style="margin-bottom: 10px;">
              <div
                v-if="!filetype2"
                style="color: #F56C6C;color: #F56C6C;font-size: 12px;line-height: 1;padding-top: 4px;"
              >文件上传格式为pdf。</div>
            </el-col>
          </el-col>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button
          class="sure"
          round
          :disabled="transferdis"
          @click="transfersubmit('transferform')"
        >确 定</el-button>
        <el-button round @click="transferClose" class="cancel">取 消</el-button>
      </span>
    </el-dialog>
    <!--             放弃入职弹出框   -->
    <el-dialog
      class="addP"
      title="放弃入职"
      :visible.sync="giveUpVisible"
      width="415px"
      :before-close="giveupclose"
    >
      <el-form :model="unpassformL" :rules="unpassrule" ref="unpassformL" label-position="top">
        <el-form-item :label-width="formLabelWidth" prop="abandonReason">
          <el-col>
            <span style="color:#333;font-weight:bold">
              <span style="color:#F56C6C;">*</span>放弃入职
            </span>
          </el-col>
          <el-input
            type="textarea"
            :autosize="{minRows:2}"
            v-model.trim="unpassformL.abandonReason"
            placeholder="请输入放弃入职的原因"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          :disabled="unpassdis"
          class="sure"
          type="primary"
          round
          @click="giveupBack('unpassformL')"
        >提交</el-button>
        <el-button class="cancel" round @click="giveupclose()">取消</el-button>
      </div>
    </el-dialog>
    <!--             取消放弃入职弹出框   -->
    <el-dialog
      class="addP"
      title="取消放弃"
      :visible.sync="giveUpVisible1"
      width="415px"
      :before-close="giveupclose1"
    >
      <el-form :model="formL" :rules="rule" ref="formL" label-position="top">
        <el-form-item :label-width="formLabelWidth" prop="cancelReason">
          <el-col>
            <span style="color:#333;font-weight:bold">
              <span style="color:#F56C6C;">*</span>取消放弃
            </span>
          </el-col>
          <el-input
            type="textarea"
            :autosize="{minRows:2}"
            v-model.trim="formL.cancelReason"
            placeholder="请输入取消放弃的原因"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          :disabled="unpassdis1"
          class="sure"
          type="primary"
          round
          @click="giveupBack1('formL')"
        >提交</el-button>
        <el-button class="cancel" round @click="giveupclose1()">取消</el-button>
      </div>
    </el-dialog>
    <!-- 面试结果查看详情 -->
    <el-dialog
      title="查看审批原因"
      :visible.sync="resultVisible"
      width="415px"
      :before-close="resultClose"
      class="addroledialog back1"
    >
      <div style="text-align: left;width: 524px;margin-top: 20px;">
        <el-row>
          <!-- <el-col>
            <span style="color: #333;font-weight: 700;">审批结果 :</span>
            <span style="color:#fb8284;">{{applyResult}}</span>
          </el-col> -->
          <el-col style="margin: 20px 0 50px;">
            <span style="color: #333;font-weight: 700;">审批原因 :</span>
            <span style="color:#9b9b9b;">{{applyMessage}}</span>
          </el-col>
        </el-row>
      </div>
    </el-dialog>
    <!-- 放弃入职查看详情 -->
    <el-dialog
      title="查看详情"
      :visible.sync="detailVisible"
      width="415px"
      :before-close="detailClose1"
      class="addroledialog back1"
    >
      <div style="text-align: left;width: 524px;margin-top: 20px;">
        <el-row>
          <el-col style="margin: 10px 0 50px;">
            <span style="color: #333;font-weight: 700;">放弃入职的原因 :</span>
            <span style="color:#9b9b9b;">{{abandonReason}}</span>
          </el-col>
        </el-row>
      </div>
    </el-dialog>
    <!-- 取消放弃查看详情 -->
    <el-dialog
      title="查看详情"
      :visible.sync="detailVisible1"
      width="415px"
      :before-close="detailClose2"
      class="addroledialog back1"
    >
      <div style="text-align: left;width: 524px;margin-top: 20px;">
        <el-row>
          <el-col style="margin: 10px 0 50px;">
            <span style="color: #333;font-weight: 700;">取消放弃的原因 :</span>
            <span style="color:#9b9b9b;">{{cancelReason}}</span>
          </el-col>
        </el-row>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogMailVisible" :before-close="cancelSend" class="back1">
      <div class="dialogBox">
        <el-row>
          <el-col :span="2" style="line-height:28px;color:#0e6195">收件人：</el-col>
          <el-col :span="10" class="receive">
            <el-input v-model="mail" style="width:200px;"></el-input>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="23">
            <div class="line"></div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="2" style="line-height:28px;color:#999798">主&nbsp;&nbsp;&nbsp;&nbsp;题：</el-col>
          <el-col :span="10" style="line-height:28px;font-size:12px;font-weight:700;margin:5px 0">
            <el-input v-model.trim="theme" placeholder="请输入主题"></el-input>
          </el-col>
        </el-row>
        <!-- <el-row>
            <el-col :span="24">
              <span style="margin-right:10px;line-height:40px"><a :href="fileUrl" class="resumeLink" target="_blank">{{originalFilename}}</a></span>
            </el-col>
        </el-row>-->
        <el-row>
          <el-col :span="23">
            <div class="lightLine"></div>
          </el-col>
        </el-row>
        <el-row style="border: 1px solid #ccc;">
          <div style="margin-left:10px">
            <p>范总，您好：</p>
            <p>以下人员需要申请，申请信息如下：</p>
          
          </div>
          <el-col style="padding-left: 10px;" class="mailtable">
            <el-table class="tablelist" ref="mailtable" :data="maildata" border>
              <el-table-column label="姓名">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.name"></el-input>
                </template>
              </el-table-column>
              <el-table-column prop="customerName" label="客户名称">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.customerName"></el-input>
                </template>
              </el-table-column>
              <el-table-column prop="postName" label="岗位名称">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.postName"></el-input>
                </template>
              </el-table-column>
              <el-table-column prop="pusher" label="申请人">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.pusher"></el-input>
                </template>
              </el-table-column>
              <el-table-column label="申请条件">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.applyCondition"></el-input>
                </template>
              </el-table-column>
              <el-table-column label="申请理由">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.applyReason"></el-input>
                </template>
              </el-table-column>
            </el-table>
          </el-col>
          <el-col
            style="text-indent: 1.5em;margin-top: 30px;margin-left: 10px;margin-bottom: 30px;"
          >
            <p>软件研发中心 {{this.userInfo.zName}}</p>
            <p>
              <span>南通东华软件有限公司</span>
            </p>
            <p>
              <span>地址 :</span>
              <span>海安市城东镇天发路9号海晟慧谷科创服务中心2号楼第8层</span>
            </p>
            <p>
              <span>邮编 :</span>
              <span>226600</span>
            </p>
            <p>
              <span>电话 :</span>
              <span>0513 - 88805918</span>
            </p>
            <p>
              <span>传真 :</span>
              <span>0513 - 88805938</span>
            </p>
            <p>
              <span>手机 :</span>
              <span>{{this.userInfo.zPhone}}</span>
            </p>
            <p>
              <span>网址 :</span>
              <span>www.ntdhcc.com</span>
            </p>
            <!-- <p>
              <span>邮箱 :</span>
              <span>{{this.zEmail}}</span>
            </p> -->
          </el-col>

          <el-col style="margin-bottom: 18px;">
            <el-row type="flex" justify="center">
              <el-col :span="23">
                <div class="lightLine"></div>
              </el-col>
            </el-row>
          </el-col>

          <el-col></el-col>
        </el-row>
      </div>
      <div slot="title" class="dialog-title">
        <el-button
          type="primary"
          @click="sendEmail"
          :disabled="!sendEmailKey"
          style="font-size:16px;"
        >
          <i class="iconfont icon-plane"></i>
          <span style="margin-left:6px;">申请</span>
        </el-button>
        <el-button @click="cancelSend">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import axios from "axios";

export default {
  cname: "interviewresult1",
  data() {
    return {
      tableData: [],
      maildata: [],
      mail: "fandp@ntdhcc.com",
      currentPage: 1,
      pagesize: 15,
      currentRow: null,
      totalcount: null,
      searchword: "",
      detaildialogVisible: false,
      list: [],
      cname: "",
      ifname: true,
      situation: [],
      resultVisible: false,
      applyResult:'',
      applyMessage:'',
      errordialogVisible: false,
      errordialogVisible1: false,
      errordialogVisible2: false,
      errordialogVisible3: false,
      transferdialogVisible: false,
      dialogMailVisible: false,
      sendEmailKey: true,
      theme: "",
      name: "",
      customerName: "",
      postName: "",
      pusher: "",
      applyCondition: "",
      applyReason: "",
      userInfo: [],
      giveUpVisible: false,
      giveUpVisible1: false,
      detailVisible: false,
      detailVisible1: false,
      unpassdis: false,
      unpassdis1: false,
      formLabelWidth: "120px",
      transferdis: false,
      timelist: ["上午", "下午"],
      transferform: {
        entryTime: null,
        sceneTime: null,
        realEntryScore: "",
        realSceneScore: "",
        idCard: "",
        idDiploma: "",
        idEducation: "",
        identityPath: "",
        identityGroup: "",
        identityFileName: "",
        identityFileAddress: "",
        identitySuffix: "",
        diplomaPath: "",
        diplomaGroup: "",
        diplomaFileName: "",
        diplomaFileAddress: "",
        diplomaSuffix: "",
        educationPath: "",
        educationGroup: "",
        educationFilename: "",
        educationAddress: "",
        educationSuffix: ""
      },
      abandonReason: "",
      cancelReason: "",
      unpassformL: {
        abandonReason: ""
      },
      unpassrule: {
        abandonReason: [
          { required: true, message: "请输入放弃入职的原因", trigger: "blur" }
        ]
      },
      formL: {
        cancelReason: ""
      },
      rule: {
        cancelReason: [
          { required: true, message: "请输入取消放弃的原因", trigger: "blur" }
        ]
      },
      transferrules: {
        entryTime: [
          { required: true, message: "请输入入职时间", trigger: "change" }
        ],
        realEntryScore: [
          { required: true, message: "请选择入职时间范围", trigger: "change" }
        ],
        sceneTime: [
          { required: true, message: "请输入到岗时间", trigger: "change" }
        ],
        realSceneScore: [
          { required: true, message: "请选择到岗时间范围", trigger: "change" }
        ],
        idCard: [
          { required: true, message: "请输入身份证号", trigger: "blur" },
          {
            pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
            message: "请输入正确的身份证号",
            trigger: "blur"
          }
        ],
        idDiploma: [
          { required: true, message: "请输入毕业证号", trigger: "blur" },
          { max: 20, message: "长度在20个字符之内", trigger: "blur" }
        ],
        idEducation: [
          { required: true, message: "请输入学历证号", trigger: "blur" },
          { max: 20, message: "长度在20个字符之内", trigger: "blur" }
        ]
      },
      errorinfo: null,
      actionurl: null,
      actionurl1: null,
      actionurl2: null,
      fileList: [],
      file: {},
      filetype: true,
      selectfile: false,
      fileList1: [],
      file1: {},
      filetype1: true,
      selectfile1: false,
      fileList2: [],
      file2: {},
      filetype2: true
    };
  },
  created() {
    //身份证身份证文件接口地址
    this.actionurl = this.url + "/statistics/entryInfo/identityUpload";
    //毕业证文件接口地址
    this.actionurl1 = this.url + "/statistics/entryInfo/diplomaUpload";
    //学历证书接口
    this.actionurl2 = this.url + "/statistics/entryInfo/educationUpload";
    axios.post(this.url + "/demand/getCustomerNames").then(res => {
      this.unlogin(res.data.code);
      if (res.data.code == 200) {
        this.list = res.data.data;
      }
    });
    axios
      .post(this.url + "/interview/result1", {
        customerName: this.cname,
        condition: this.searchword,
        pageNum: this.currentPage,
        pageSize: this.pagesize
      })
      .then(res => {
        this.unlogin(res.data.code);
        if (res.data.code == 200) {
          this.tableData = res.data.data.list;
          this.totalcount = res.data.data.total;
        }
      });
  },
  methods: {
    search() {
      this.currentPage = 1;
      this.selectname();
    },
    selectname() {
      axios
        .post(this.url + "/interview/result1", {
          customerName: this.cname,
          condition: this.searchword,
          pageNum: this.currentPage,
          pageSize: this.pagesize
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            if (this.cname !== "") {
              this.ifname = false;
            } else {
              this.ifname = true;
            }
            this.tableData = res.data.data.list;
            this.totalcount = res.data.data.total;
          }
        });
    },
    //改变表格的页面展示数量
    handleSizeChange(val) {
      this.pagesize = val;
      this.selectname();
    },
    //修改当前表格页数
    pagehandleCurrentChange(val) {
      this.currentPage = val;
      this.selectname();
    },
    //点击表格行，获取当前行的数据
    handleCurrentChange(val) {
      this.currentRow = val;
    },
    resultShow(row) {
      this.resultVisible = true;
      document.documentElement.style.overflow = "hidden";
      axios
        .post(this.url + "/interview/getResult", {
          name: row.row.name,
          postName: row.row.postName,
          customerName: row.row.customerName,
        })
        .then(res => {
          this.applyMessage = res.data.data;
        });
    },
    detailShow(row) {
      this.detaildialogVisible = true;
      document.documentElement.style.overflow = "hidden";
      axios
        .post(this.url + "/interview/detail", {
          id: row.row.id
        })
        .then(res => {
          this.situation = res.data.data;
          for (var i = 0; i < this.situation.length; i++) {
            if (i == 0) {
              this.situation[i].type = "一面";
            }
            if (i == 1) {
              this.situation[i].type = "二面";
            }
            if (i == 2) {
              this.situation[i].type = "三面";
            }
          }
        });
    },
    detailClose() {
      this.detaildialogVisible = false;
      document.documentElement.style.overflow = "auto";
    },
    resultClose() {
      this.resultVisible = false;
      document.documentElement.style.overflow = "auto";
    },
    handleClose() {
      this.errordialogVisible = false;
      document.documentElement.style.overflow = "auto";
    },
    handleClose1() {
      this.errordialogVisible1 = false;
      document.documentElement.style.overflow = "auto";
    },
    handleClose2(row) {
      this.errordialogVisible2 = false;
      this.$refs.singleTable.setCurrentRow(row);
      this.currentRow = null;
      document.documentElement.style.overflow = "auto";
    },
    handleClose3(row) {
      this.errordialogVisible3 = false;
      this.$refs.singleTable.setCurrentRow(row);
      this.currentRow = null;
      document.documentElement.style.overflow = "auto";
    },
    // 发送按钮点击
    sendClick() {
      if (this.currentRow == null) {
        document.documentElement.style.overflow = "hidden";
        this.errordialogVisible = !this.errordialogVisible;
      } else {
         if (this.currentRow.result == "通过") {
           this.maildata = [];
           this.dialogMailVisible = true;
                document.documentElement.style.overflow = "hidden";
                axios
                  .post(this.url + "/interview/getApplyDetail", {
                    id: this.currentRow.id
                  })
                  .then(res => {
                    this.unlogin(res.data.code);
                    if (res.data.code == 200) {
                      this.maildata.push(res.data.data);
                      this.name = this.maildata[0].name;
                      this.customerName = this.maildata[0].customerName;
                      this.postName = this.maildata[0].postName;
                      this.pusher = this.maildata[0].pusher;
                      this.applyCondition = this.maildata[0].applyCondition;
                      this.applyReason = this.maildata[0].applyReason;
                      this.userInfo.zName = this.maildata[0].zName;
                      this.userInfo.zPhone = this.maildata[0].zPhone;
                    }
                  });
         } else if (this.currentRow.result == "审批通过" || this.currentRow.result == "审批驳回") {
          this.errorinfo = "该候选人已审批!";
          this.errordialogVisible1 = true;
          document.documentElement.style.overflow = "hidden";
        }  else if (this.currentRow.result == "入职") {
          this.errorinfo = "该候选人已入职!";
          this.errordialogVisible1 = true;
          document.documentElement.style.overflow = "hidden";
        } else if (
          this.currentRow.result !== "入职" &&
          this.currentRow.result !== "通过"
        ) {
          this.errorinfo = "该候选人未通过面试!";
          this.errordialogVisible1 = true;
          document.documentElement.style.overflow = "hidden";
        }
            
            
            }
    },
    // 取消发送邮件
    cancelSend() {
      this.dialogMailVisible = false;
      document.documentElement.style.overflow = "auto";
      this.$refs.singleTable.setCurrentRow();
      this.maildata = [];
    },
    sendEmail() {
      this.sendEmailKey = false;
      axios
        .post(this.url + "/interview/sendApplyMail", {
          subject: this.theme,
          receiveMail: this.mail,
          id: this.currentRow.id,
          name: this.maildata[0].name,
          customerName: this.maildata[0].customerName,
          postName: this.maildata[0].postName,
          pusher: this.maildata[0].pusher,
          applyCondition: this.maildata[0].applyCondition,
          applyReason: this.maildata[0].applyReason,
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.sendEmailKey = true;
            this.dialogMailVisible = false;
            document.documentElement.style.overflow = "auto";
            this.$refs.singleTable.setCurrentRow();
            this.maildata =[];
            this.name ="";
            this.customerName ="";
            this.postName ="";
            this.pusher = "";
            this.applyCondition = "";
            this.applyReason = "";
            this.pusher = "";
            this.selectname();
          }
        });
    },
    transfer() {
      if (this.currentRow == null) {
        document.documentElement.style.overflow = "hidden";
        this.errordialogVisible = !this.errordialogVisible;
      } else {
        if (this.currentRow.result == "通过" || this.currentRow.result == "审批通过") {
          this.transferdialogVisible = true;
          document.documentElement.style.overflow = "hidden";
          this.selectfile = false;
          this.selectfile1 = false;
          this.filetype = true;
          this.filetype1 = true;
          this.filetype2 = true;
          this.file = {};
          this.fileList = [];
          this.file1 = {};
          this.fileList1 = [];
          this.file2 = {};
          this.fileList2 = [];
          this.$nextTick(() => {
            this.$refs.transferform.resetFields();
          });
        } else if (this.currentRow.result == "入职") {
          this.errorinfo = "该候选人已入职!";
          this.errordialogVisible1 = true;
          document.documentElement.style.overflow = "hidden";
        } else if (
          this.currentRow.result !== "入职" &&
          this.currentRow.result !== "通过"
        ) {
          this.errorinfo = "该候选人未通过面试!";
          this.errordialogVisible1 = true;
          document.documentElement.style.overflow = "hidden";
        }
      }
    },
    // 提交转入职的表单
    transfersubmit(formName) {
      if (this.file.name == undefined) {
        this.selectfile = true;
      } else {
        this.selectfile = false;
      }

      if (this.file1.name == undefined) {
        this.selectfile1 = true;
      } else {
        this.selectfile1 = false;
      }

      this.$refs[formName].validate(valid => {
        if (
          valid &&
          !this.selectfile &&
          this.filetype &&
          this.filetype1 &&
          !this.selectfile1
        ) {
          this.transferdis = true;
          axios
            .post(this.url + "/interview/insertentry", {
              id: this.currentRow.id,
              resumeUploadId: this.currentRow.resumeUploadId,
              entryTime: this.transferform.entryTime,
              sceneTime: this.transferform.sceneTime,
              realEntryScore: this.transferform.realEntryScore,
              realSceneScore: this.transferform.realSceneScore,
              idCard: this.transferform.idCard,
              idDiploma: this.transferform.idDiploma,
              idEducation: this.transferform.idEducation,
              identityPath: this.transferform.identityPath,
              identityGroup: this.transferform.identityGroup,
              identityFileName: this.transferform.identityFileName,
              identityFileAddress: this.transferform.identityFileAddress,
              identitySuffix: this.transferform.identitySuffix,
              diplomaPath: this.transferform.diplomaPath,
              diplomaGroup: this.transferform.diplomaGroup,
              diplomaFileName: this.transferform.diplomaFileName,
              diplomaFileAddress: this.transferform.diplomaFileAddress,
              diplomaSuffix: this.transferform.diplomaSuffix,
              educationPath: this.transferform.educationPath,
              educationGroup: this.transferform.educationGroup,
              educationFilename: this.transferform.educationFilename,
              educationAddress: this.transferform.educationAddress,
              educationSuffix: this.transferform.educationSuffix
            })
            .then(res => {
              this.unlogin(res.data.code);
              if (res.data.code == 200) {
                this.transferdis = false;
                this.selectname();
                this.$refs.transferform.resetFields();
                this.transferdialogVisible = false;
                document.documentElement.style.overflow = "auto";
              }
            });
        }
      });
    },
    transferClose() {
      this.transferdis = false;
      this.$refs.transferform.resetFields();
      this.selectfile = false;
      this.selectfile1 = false;
      this.filetype = true;
      this.filetype1 = true;
      this.filetype2 = true;
      this.file = {};
      this.fileList = [];
      this.file1 = {};
      this.fileList1 = [];
      this.file2 = {};
      this.fileList2 = [];
      this.transferdialogVisible = false;
      document.documentElement.style.overflow = "auto";
    },
    giveup() {
      if (this.currentRow == null) {
        document.documentElement.style.overflow = "hidden";
        this.errordialogVisible = !this.errordialogVisible;
      } else {
        if (
          this.currentRow.result == "通过" ||
          this.currentRow.result == "入职"
        ) {
          if (this.currentRow.zyIsoperate == "暂无反馈") {
            document.documentElement.style.overflow = "hidden";
            this.errordialogVisible = false;
            this.giveUpVisible = true;
            this.$nextTick(() => {
              this.$refs.unpassformL.resetFields();
            });
          } else {
            this.errordialogVisible2 = true;
            document.documentElement.style.overflow = "hidden";
          }
        } else {
          this.errordialogVisible2 = true;
          document.documentElement.style.overflow = "hidden";
        }
      }
    },
    giveupclose(row) {
      this.giveUpVisible = false;
      this.$refs.singleTable.setCurrentRow(row);
      this.currentRow = null;
      document.documentElement.style.overflow = "auto";
    },
    //专员对放弃入职的提交
    giveupBack(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.unpassdis = true;
          axios
            .post(this.url + "/interview/abandonHandle", {
              resumeUploadId: this.currentRow.resumeUploadId,
              abandonReason: this.unpassformL.abandonReason
            })
            .then(res => {
              if (res.data.code == 200) {
                this.unpassdis = false;
                this.giveUpVisible = false;
                this.selectname();
                this.$refs.unpassformL.resetFields();
                document.documentElement.style.overflow = "auto";
              }
            });
        }
      });
    },
    deletedata() {
      if (this.currentRow == null) {
        document.documentElement.style.overflow = "hidden";
        this.errordialogVisible = !this.errordialogVisible;
      } else {
        if (this.currentRow.zyIsoperate == "放弃入职") {
          document.documentElement.style.overflow = "hidden";
          this.errordialogVisible = false;
          this.giveUpVisible1 = true;
          this.$nextTick(() => {
            this.$refs.formL.resetFields();
          });
        } else {
          this.errordialogVisible3 = true;
          document.documentElement.style.overflow = "hidden";
        }
      }
    },
    giveupclose1(row) {
      this.giveUpVisible1 = false;
      this.$refs.singleTable.setCurrentRow(row);
      this.currentRow = null;
      document.documentElement.style.overflow = "auto";
    },
    //专员对取消放弃入职的提交
    giveupBack1(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.unpassdis1 = true;
          axios
            .post(this.url + "/interview/cancelAbandon", {
              resumeUploadId: this.currentRow.resumeUploadId,
              cancelReason: this.formL.cancelReason
            })
            .then(res => {
              if (res.data.code == 200) {
                this.unpassdis1 = false;
                this.giveUpVisible1 = false;
                this.selectname();
                this.$refs.formL.resetFields();
                document.documentElement.style.overflow = "auto";
              }
            });
        }
      });
    },
    //放弃入职查看详情
    viewdetail1(row) {
      this.detailVisible = true;
      document.documentElement.style.overflow = "hidden";
      axios
        .post(this.url + "/interview/selByIdrz", {
          id: row.resumeUploadId
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            if (res.data.data !== null) {
              this.abandonReason =
                res.data.data.interviewResultVo.abandonReason;
            }
          }
        });
    },
    detailClose1(row) {
      this.detailVisible = false;
      this.$refs.singleTable.setCurrentRow(row);
      this.currentRow = null;
      document.documentElement.style.overflow = "auto";
    },
    //取消放弃查看详情
    viewdetail2(row) {
      this.detailVisible1 = true;
      document.documentElement.style.overflow = "hidden";
      axios
        .post(this.url + "/interview/selByIdqx", {
          id: row.resumeUploadId
        })
        .then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            if (res.data.data !== null) {
              this.cancelReason = res.data.data.interviewResultVo.cancelReason;
            }
          }
        });
    },
    detailClose2() {
      this.detailVisible1 = false;
      document.documentElement.style.overflow = "auto";
    },
    // 上传身份证信息的文件
    beforeupload(file) {
      this.file = {};
      this.file = file;
      this.selectfile = false;
      var testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
      this.filetype = testmsg == "pdf";

      if (this.filetype) {
        this.file = file;
        this.fileList = [];
        this.fileList.push(this.file);
      }

      return this.filetype;
    },
    handleRemove(file, fileList) {
      this.file = {};
      this.fileList = [];
      this.transferform.identityPath = "";
      this.transferform.identityGroup = "";
      this.transferform.identityFileName = "";
      this.transferform.identityFileAddress = "";
      this.transferform.identitySuffix = "";
    },
    handleAvatarSuccess(res, file) {
      this.transferform.identityPath = res.data.identityPath;
      this.transferform.identityGroup = res.data.identityGroup;
      this.transferform.identityFileName = res.data.identityFileName;
      this.transferform.identityFileAddress = res.data.identityFileAddress;
      this.transferform.identitySuffix = res.data.identitySuffix;
    },
    // 上传毕业证信息的文件
    beforeupload1(file) {
      this.file1 = {};
      this.file1 = file;
      this.selectfile1 = false;
      var testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
      this.filetype1 = testmsg == "pdf";
      if (this.filetype1) {
        this.file1 = file;
        this.fileList1 = [];
        this.fileList1.push(this.file1);
      }
      return this.filetype1;
    },
    handleRemove1(file, fileList) {
      this.fileList1 = [];
      this.file1 = {};
      this.transferform.diplomaPath = "";
      this.transferform.diplomaGroup = "";
      this.transferform.diplomaFileName = "";
      this.transferform.diplomaFileAddress = "";
      this.transferform.diplomaSuffix = "";
    },
    handleAvatarSuccess1(res, file) {
      this.transferform.diplomaPath = res.data.diplomaPath;
      this.transferform.diplomaGroup = res.data.diplomaGroup;
      this.transferform.diplomaFileName = res.data.diplomaFileName;
      this.transferform.diplomaFileAddress = res.data.diplomaFileAddress;
      this.transferform.diplomaSuffix = res.data.diplomaSuffix;
    },
    // 上传学位证信息的文件
    beforeupload2(file) {
      this.file2 = {};
      this.file2 = file;
      var testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
      this.filetype2 = testmsg == "pdf";
      if (this.filetype2) {
        this.file2 = file;
        this.fileList2 = [];
        this.fileList2.push(this.file2);
      }
      return this.filetype2;
    },
    handleRemove2(file, fileList) {
      this.fileList2 = [];
      this.file2 = {};
      this.transferform.educationPath = "";
      this.transferform.educationGroup = "";
      this.transferform.educationFilename = "";
      this.transferform.educationAddress = "";
      this.transferform.educationSuffix = "";
    },
    handleAvatarSuccess2(res, file) {
      this.transferform.educationPath = res.data.educationPath;
      this.transferform.educationGroup = res.data.educationGroup;
      this.transferform.educationFilename = res.data.educationFilename;
      this.transferform.educationAddress = res.data.educationAddress;
      this.transferform.educationSuffix = res.data.educationSuffix;
    }
  },
  watch: {
    searchword: function(val) {
      if (val == "") {
        this.currentPage = 1;
        this.selectname();
      }
    }
  }
};
</script>

<style scoped>
.title {
  background-color: #fff;
  height: 40px;
  line-height: 40px;
  font-size: 14px;
  padding-left: 20px;
  margin-top: 6px;
  margin-bottom: 6px;
}

.posttable {
  min-height: 700px;
  background-color: #fff;
}

.entry {
  width: 65px;
  height: 28px;
  padding: 7px 15px !important;
  opacity: 0.86;
  margin-left: 5px;
  color: #fff;
  background: linear-gradient(to bottom, #2887ee 0%, #2c85e6 100%);
}

.entry:hover {
  color: #fff !important;
}

.entry:focus {
  color: #fff !important;
}
.send {
  width: 65px;
  height: 28px;
  opacity: 0.86;
  color: #fff;
  background: linear-gradient(to bottom, #fc2342 0%, #d51934 100%);
  padding: 7px 15px !important;
}

.send:hover {
  color: #fff !important;
}
.edit {
  width: 78px;
  height: 28px;
  opacity: 0.86;
  color: #fff;
  background: linear-gradient(to bottom, #00cebf 0%, #009085 100%);
  padding: 7px 15px !important;
}

.edit:hover {
  color: #fff !important;
}

.edit:focus {
  color: #fff !important;
}

.delete {
  width: 78px;
  height: 28px;
  padding: 7px 15px !important;
  opacity: 0.86;
  color: #fff;
  background: linear-gradient(to bottom, #ffbc1c 0%, #f69710 100%);
}

.delete:hover {
  color: #fff !important;
}

.delete:focus {
  color: #fff !important;
}

.hand {
  color: #1099ff;
}

.pager {
  margin-top: 20px;
}

.pager {
  width: 100%;
  overflow: hidden;
  position: relative;
  margin-top: 10px;
  margin-bottom: 10px;
}

.el-pagination {
  margin-left: 50%;
  transform: translateX(-50%);
}

.arrow {
  width: 0px;
  height: 0px;
  border-top: 10px solid transparent;
  border-right: 10px solid;
  border-bottom: 10px solid transparent;
  position: absolute;
  margin-left: -10px;
  margin-top: 5px;
  border-right-color: #f4f4f4;
}

.upload {
  width: 194px !important;
  height: 44px !important;
  margin-top: 10px;
  /* margin-bottom: 30px; */
}
</style>
